package com.xyy.saas.payment.service.reconciliation.strategy;

import com.alibaba.fastjson.JSON;
import com.xyy.saas.payment.enums.ReconciliationType;
import com.xyy.saas.payment.pojo.dto.ReconcileContext;
import com.xyy.saas.payment.service.reconciliation.ReconciliationStrategy;
import com.xyy.saas.payment.service.reconciliation.impl.FundAccountCheckService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author wangzeqi
 */
@Slf4j
@Component
public class FundAccountStrategy implements ReconciliationStrategy {

    @Autowired
    private FundAccountCheckService fundAccountCheckService;

    @Override
    public void execute(ReconcileContext context) {
        log.info("执行资金账户对账, context:{}", JSON.toJSONString(context));
        // 核对范围 交易时间 D-1
        fundAccountCheckService.reconcileFundAccount(context);
    }

    @Override
    public ReconciliationType getType() {
        return ReconciliationType.FUND_ACCOUNT;
    }

}
